import React from 'react';
import { Button, Icon } from 'antd';
import styles from '@/pages/riskControl/deviantWithdrawReview/details/index.less';
import { initDefaultDate } from '@/utils/utils';

export const Flag = (props: any) => (
  <div className={styles['flag-title']}>
    <Icon type="flag"></Icon>
    <span>{props.children}</span>
  </div>
);

export const DefaultTitle = (props: any) => {
  const { parentAgent, username, handleNext } = props;
  return (
    <div className={styles['default-title']}>
      {parentAgent && (
        <React.Fragment>
          <span>上级代理：</span>
          <Button
            type="primary"
            ghost
            onClick={() => {
              // eslint-disable-next-line no-unused-expressions
              handleNext && handleNext();
            }}
          >
            {parentAgent}
          </Button>
        </React.Fragment>
      )}
      {username && (
        <React.Fragment>
          <span>账户名称：</span>
          <Button type="primary" disabled>
            {username}
          </Button>
        </React.Fragment>
      )}
    </div>
  );
};

const getDateTimeStampData = (data: number) => {
  const dataArr = initDefaultDate(data).map(item => item.valueOf());
  return dataArr;
};

export const dateObj = {
  today: getDateTimeStampData(1),
  month: getDateTimeStampData(30),
  all: [],
};
